<!DOCTYPE html>
<html>
<head>
  <title>{$sys_config['site_name']}</title>
  {include file="public/head" /}
</head>
<body>
<div class="wrapper" >

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper" style="background: #fff">
 

    <!-- Main content -->
    <section class="content container-fluid" >

      <div class="row" >
        <div class="col-xs-12">
             <!-- form start -->
            <form id="attrForm" action="{:url('AdminGroup/saveGroup')}" class="form-horizontal">
              <input type="hidden" name="group_id" value="{$group_id}">
              <div class="box-body">
                {volist name="menu" id="vo"}
                <div class="form-group">
                  <label for="inputPassword3" class="col-sm-2 control-label">
                    <input type="checkbox" name="menu_id[]"  {in name="vo.menu_id" value="$check_power"}checked{/in} value="{$vo.menu_id}" class="checkbox-toggle">{$vo.menu_name}</label>
                  <div class="col-sm-10 mailbox-messages">
                    <table class="table table-hover table-striped ">
                      <tbody>
                      {volist name="vo.child" id="v"}
                      <tr>
                        <th class="col-xs-4" style="color: #666"><input type="checkbox" {in name="v.menu_id" value="$check_power"}checked{/in} name="menu_id[]" value="{$v.menu_id}">{$v.menu_name}</th>
                        <td>
                          {volist name="v.child" id="val"}<span class="col-xs-4"><input type="checkbox" {in name="val.menu_id" value="$check_power"}checked{/in} name="menu_id[]" value="{$val.menu_id}"> value="{$val.menu_name}"</span>{/volist}
                        </tr>

                      {/volist}
                     
                      </tbody>
                     </table>
                  </div>
                </div>
               {/volist}

              </div>
            </form>
        </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
</div>
<!-- ./wrapper -->
{include file="public/js" /}
<script type="text/javascript">
  $(function () {
      $(".checkbox-toggle").click(function () {
          if($(this).prop('checked')){
              $(this).parents('.form-group').find("input[type='checkbox']").prop('checked',true);
          }else{
              $(this).parents('.form-group').find("input[type='checkbox']").prop('checked',false);
          }
      });

      $(".mailbox-messages th input[type='checkbox']").click(function () {
          var pdiv=$(this).parents('.form-group');
          if($(this).prop('checked')){
              $(this).parents('tr').find("input[type='checkbox']").prop('checked',true);
              pdiv.find(".checkbox-toggle").prop('checked',true);
          }else{
              var is_check=0;
              $(".mailbox-messages th input[type='checkbox']:checked").each(function () {
                  is_check=1;
              });
              if(is_check==0) pdiv.find(".checkbox-toggle").prop('checked',false);
              $(this).parents('tr').find("input[type='checkbox']").prop('checked',false);
          }
      });

      $(".mailbox-messages td input[type='checkbox']").click(function () {
          var pdiv=$(this).parents('.form-group');
          if($(this).prop('checked')){
              $(this).parents('tr').find("th input[type='checkbox']").prop('checked',true);
              pdiv.find(".checkbox-toggle").prop('checked',true);
          }else{
              var is_s_check=0;
              $(".mailbox-messages td input[type='checkbox']:checked").each(function () {
                  is_s_check=1;
              });
              if(is_s_check==0)$(this).parents('tr').find("th input[type='checkbox']").prop('checked',false);

              var is_check=0;
              $(".mailbox-messages input[type='checkbox']:checked").each(function () {
                  is_check=1;
              });
              if(is_check==0)pdiv.find(".checkbox-toggle").prop('checked',false);
          }
      });
  });
  function confirm() {
        return $("#attrForm").serialize();
    }

</script>
</body>
</html>